var iBannerW = 120; //do rong cua Banner
var iBodyW = 990; //do rong cua Body
var iMarginLeft = 10; // margin left cua Body
var iMarginRight = 10; // margin right cua Body
var iMarginTop = 5; // margin top cua Banner
function Banner_Float() {

    var iWidth = document.body.offsetWidth;
    var objLeft = document.getElementById("left_banner");
    var objRight = document.getElementById("right_banner");
    var top = document.documentElement.scrollTop >=
                document.body.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
    //Tren IE, FF:    document.documentElement.scrollTop () :
    //TRen Chorme 	  document.body.scrollTop;
    objLeft.style.top = top + iMarginTop + "px";
    objRight.style.top = top + iMarginTop + "px";
}
function Banner_Postion() {
    var iWidth = document.body.offsetWidth;
    var objLeft = document.getElementById("left_banner");
    var objRight = document.getElementById("right_banner");
    //

    if (iWidth - iBodyW < iBannerW * 2) {
        objLeft.style.visibility = 'hidden';
        objRight.style.visibility = 'hidden';
    }
    else {
        objLeft.style.visibility = 'visible';
        objRight.style.visibility = 'visible';
    }
    //
    var iLeft = (iWidth - iBodyW) / 2 - iBannerW - iMarginLeft;
    objLeft.style.left = iLeft + "px";
    //
    var iRight = (iWidth - iBodyW) / 2 + iBodyW + iMarginRight;
    
    objRight.style.left = iRight + "px";
    //
    objLeft.style.top = iMarginTop + "px";
    objRight.style.top = iMarginTop + "px";
}
window.onload = Banner_Postion;
window.onresize = Banner_Postion;
window.onscroll = Banner_Float;
